<template>
  <div class="card-container">
    <a :href="props.gameCardItem.link" target="_blank">
      <div class="img">
        <img
          :src="props.gameCardItem.img"
          :alt="props.gameCardItem.name"
          style="width: 100%; height: 100%"
        />
      </div>
      <div class="name">{{ props.gameCardItem.name }}</div>
      <span class="score">{{ props.gameCardItem.score }}</span>
    </a>
  </div>
</template>

<script setup>
const props = defineProps({
  gameCardItem: Object,
});
</script>

<style scoped lang="less">
.card-container {
  width: 136px;
  height: 180px;
  margin: 0 15px 8px;
  padding-top: 22px;
  position: relative;
  float: left;

  a {
    width: 100%;
    height: 100%;
    &:hover img {
      transform: scale(1.1);
    }
    .img {
      width: 100%;
      height: 100%;
      overflow: hidden;
      border-radius: 8px;
      box-shadow: 0 1px 10px 6px rgba(0, 0, 0, 0.4);
      img {
        transition: all 0.3s;
      }
    }
    .name {
      position: absolute;
      width: 100%;
      overflow: hidden;
      height: 21px;
      line-height: 21px;
      overflow: hidden;
      background-color: rgba(0, 0, 0, 0.6);
      border-radius: 0px 0px 8px 8px;
      left: 0;
      bottom: 0;
      text-align: center;
      color: #fff;
    }
    .score {
      display: block;
      position: absolute;
      width: 43px;
      height: 43px;
      top: 0;
      left: -14px;
      background: url(https://0day.ali213.net/images/w7.png) no-repeat center
        center;
      background-size: 100%;
      text-align: center;
      line-height: 43px;
    }
  }
}
</style>
